DLB( L, book_v, chap_v, verse_v)
{
filereadline, max, max.txt, %L%
;=====download========
;=====================
ifinstring, book_v, %a_space%
	stringreplace, book_v, book_v, %a_space%, _

URL = http://bible.cc/%book_v%/%chap_v%-%verse_v%.htm
urlDownloadtofile, %URL%, s.xml
if errorlevel = 1
	{
	errorlevel = "download failed, check internet connection and try again." ;replace msgbox, with return errorlevel. change errorlevel to msg.
	return errorlevel
	}
;=====end download====
;=====================

FileRead, NoHTM, s.xml ;read html downloaded, check for correct chap/verse

ifexist, s.xml
	Filedelete, s.xml

StringReplace, NoHTM, NoHTM, <title>, \
stringReplace, NoHTM, NoHTM, </title>, \

loop, Parse, NoHTM, \
{
	if A_index = 2
	{
	IfInString, NoHTM, Online Parallel Bible
		if (chap_v > max)
		{
		errorlevel = "That book does not have that many chapters"
		return errorlevel		;replaces msgbox with return
		;L := L+1    	;adding code so function can download whole bible if need be.
		}
		else
		{						    ;will also only open the scripture, if calling the function externaly.
		errorlevel = "that Chapter does not have that many verses."
		return errorlevel 		;replace msgbox with return
		;verse_v := verse_v+1
		}
			NoHTM = %A_LoopField%
	}
}

stringreplace, book_v, book_v, _, %A_space%
stringreplace, Nohtm, nohtm, %book_v%,
stringreplace, nohtm, nohtm, %chap_v%,
stringreplace, script, nohtm, %verse_v%
stringtrimleft, script, script, 3
return, script

}